{ "cells": [ { "cell_type": "markdown", "id": "likely-radio", "metadata": {}, "source": [ "# NFT Price Floor Python API Tutorial " ] }, { "cell_type": "markdown", "id": "d22e8023", "metadata": {}, "source": [ "This tutorial aims to be a quick guide to get you started using the NFTPriceFloor API integrated into messari's python library." ] }, { "cell_type": "code", "execution_count": 1, "id": "593e4795", "metadata": {}, "outputs": [], "source": [ "from messari.nfts import NFTPriceFloor\n", "floor = NFTPriceFloor()" ] }, { "cell_type": "code", "execution_count": 2, "id": "d11d83c9", "metadata": {}, "outputs": [], "source": [ "collections = ['boredApesYC', 'coolCats', 'cryptoPunks']" ] }, { "cell_type": "markdown", "id": "813f1412", "metadata": {}, "source": [ "## API Structure\n", "The NFT Price Floor Python client contains a number of functions that wrap some NFT Price Floor's API endpoints. These include:\n", "\n", "Functions\n", "\n", "* get_nfts\n", "* get_floor\n", "* get_info\n", "\n", "Below are a few examples to showcase the functionality and types of data each function generates." ] }, { "cell_type": "markdown", "id": "ecd6b9b7", "metadata": {}, "source": [ "## Functions" ] }, { "cell_type": "markdown", "id": "a40e89fa", "metadata": {}, "source": [ "### get_nfts" ] }, { "cell_type": "markdown", "id": "3b1e3b3d", "metadata": {}, "source": [ "Retrieve basic info for all nfts" ] }, { "cell_type": "code", "execution_count": 3, "id": "de221c03", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
slugnamefloorPriceETHfloorPriceUSDfloorCapETHfloorCapUSDtotalSupplyvariationETHvariationUSDtypeurlrankingcountOnSalelistedRatiolastModificationsalesData
0boredApesYCBored Ape YC65.50226189655000226189185010000-5.06-14.31avatarhttps://opensea.io/collection/boredapeyachtclu...1118601943015551.186019e+112022-01-06 06:15:09{'_id': '61d686a9956dff76eb38c901', 'slug': 'b...
1cryptoPunksCryptoPunks63.50219283635000219282645010000-4.08-13.43avatarhttps://www.larvalabs.com/cryptopunks/forsale214031.403000e+012022-01-06 05:45:04{'_id': '61d686aa956dff76eb38c989', 'slug': 'c...
2mutantApesYCMutant Ape YC13.894796624502084611883417640-6.78-15.86avatarhttps://opensea.io/collection/mutant-ape-yacht...3118601943027846.723466e+102022-01-06 06:14:06{'_id': '61d686aa956dff76eb38c969', 'slug': 'm...
3veeFriendsVeeFriends11.784068012080441716848410255-0.08-9.82avatarhttps://opensea.io/collection/veefriends?colle...411860194308991.156528e+102022-01-06 06:13:09{'_id': '61d686aa956dff76eb38c959', 'slug': 'v...
4cloneXCLONE X5.301830210600036604662020000-18.46-26.41avatarhttps://opensea.io/collection/clonex?collectio...5118601943034655.930097e+102022-01-06 06:13:36{'_id': '61d686ab956dff76eb38c9fb', 'slug': 'c...
\n", "
" ], "text/plain": [ " slug name floorPriceETH floorPriceUSD floorCapETH \\\n", "0 boredApesYC Bored Ape YC 65.50 226189 655000 \n", "1 cryptoPunks CryptoPunks 63.50 219283 635000 \n", "2 mutantApesYC Mutant Ape YC 13.89 47966 245020 \n", "3 veeFriends VeeFriends 11.78 40680 120804 \n", "4 cloneX CLONE X 5.30 18302 106000 \n", "\n", " floorCapUSD totalSupply variationETH variationUSD type \\\n", "0 2261891850 10000 -5.06 -14.31 avatar \n", "1 2192826450 10000 -4.08 -13.43 avatar \n", "2 846118834 17640 -6.78 -15.86 avatar \n", "3 417168484 10255 -0.08 -9.82 avatar \n", "4 366046620 20000 -18.46 -26.41 avatar \n", "\n", " url ranking countOnSale \\\n", "0 https://opensea.io/collection/boredapeyachtclu... 1 11860194301555 \n", "1 https://www.larvalabs.com/cryptopunks/forsale 2 1403 \n", "2 https://opensea.io/collection/mutant-ape-yacht... 3 11860194302784 \n", "3 https://opensea.io/collection/veefriends?colle... 4 1186019430899 \n", "4 https://opensea.io/collection/clonex?collectio... 5 11860194303465 \n", "\n", " listedRatio lastModification \\\n", "0 1.186019e+11 2022-01-06 06:15:09 \n", "1 1.403000e+01 2022-01-06 05:45:04 \n", "2 6.723466e+10 2022-01-06 06:14:06 \n", "3 1.156528e+10 2022-01-06 06:13:09 \n", "4 5.930097e+10 2022-01-06 06:13:36 \n", "\n", " salesData \n", "0 {'_id': '61d686a9956dff76eb38c901', 'slug': 'b... \n", "1 {'_id': '61d686aa956dff76eb38c989', 'slug': 'c... \n", "2 {'_id': '61d686aa956dff76eb38c969', 'slug': 'm... \n", "3 {'_id': '61d686aa956dff76eb38c959', 'slug': 'v... \n", "4 {'_id': '61d686ab956dff76eb38c9fb', 'slug': 'c... " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nfts = floor.get_nfts()\n", "nfts.head()" ] }, { "cell_type": "markdown", "id": "b2fc3ef5", "metadata": {}, "source": [ "### get_floor" ] }, { "cell_type": "markdown", "id": "a6ae73f1", "metadata": {}, "source": [ "Retrive floor data for collection(s)" ] }, { "cell_type": "code", "execution_count": 4, "id": "265a2d8c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
boredApesYCcoolCatscryptoPunks
dataPriceFloorETHdataPriceFloorUSDdataVolumeETHdataVolumeUSDsalesdataPriceFloorETHdataPriceFloorUSDdataVolumeETHdataVolumeUSDsalesdataPriceFloorETHdataPriceFloorUSDdataVolumeETHdataVolumeUSDsales
dates
2022-01-05 08:00:0069.4050264470.0319.98001217657.04.010.632540516.0134.959513938.010.066.6225253869.00.000.00.0
2022-01-05 16:00:0069.5000265250.0472.44001803061.07.010.668740718.083.100317570.06.065.4462249785.064.99246631.01.0
2022-01-06 00:00:0068.9375254068.0848.30993064901.012.010.022536924.0358.0901317477.032.063.6225234474.0399.071423713.06.0
2022-01-06 06:15:0465.9714231415.0602.50702102787.08.0NaNNaNNaNNaNNaN63.2857221982.0137.00487296.02.0
2022-01-06 06:17:33NaNNaNNaNNaNNaN9.951434908.096.390337667.09.0NaNNaNNaNNaNNaN
\n", "
" ], "text/plain": [ " boredApesYC \\\n", " dataPriceFloorETH dataPriceFloorUSD dataVolumeETH \n", "dates \n", "2022-01-05 08:00:00 69.4050 264470.0 319.9800 \n", "2022-01-05 16:00:00 69.5000 265250.0 472.4400 \n", "2022-01-06 00:00:00 68.9375 254068.0 848.3099 \n", "2022-01-06 06:15:04 65.9714 231415.0 602.5070 \n", "2022-01-06 06:17:33 NaN NaN NaN \n", "\n", " coolCats \\\n", " dataVolumeUSD sales dataPriceFloorETH dataPriceFloorUSD \n", "dates \n", "2022-01-05 08:00:00 1217657.0 4.0 10.6325 40516.0 \n", "2022-01-05 16:00:00 1803061.0 7.0 10.6687 40718.0 \n", "2022-01-06 00:00:00 3064901.0 12.0 10.0225 36924.0 \n", "2022-01-06 06:15:04 2102787.0 8.0 NaN NaN \n", "2022-01-06 06:17:33 NaN NaN 9.9514 34908.0 \n", "\n", " cryptoPunks \\\n", " dataVolumeETH dataVolumeUSD sales dataPriceFloorETH \n", "dates \n", "2022-01-05 08:00:00 134.959 513938.0 10.0 66.6225 \n", "2022-01-05 16:00:00 83.100 317570.0 6.0 65.4462 \n", "2022-01-06 00:00:00 358.090 1317477.0 32.0 63.6225 \n", "2022-01-06 06:15:04 NaN NaN NaN 63.2857 \n", "2022-01-06 06:17:33 96.390 337667.0 9.0 NaN \n", "\n", " \n", " dataPriceFloorUSD dataVolumeETH dataVolumeUSD sales \n", "dates \n", "2022-01-05 08:00:00 253869.0 0.00 0.0 0.0 \n", "2022-01-05 16:00:00 249785.0 64.99 246631.0 1.0 \n", "2022-01-06 00:00:00 234474.0 399.07 1423713.0 6.0 \n", "2022-01-06 06:15:04 221982.0 137.00 487296.0 2.0 \n", "2022-01-06 06:17:33 NaN NaN NaN NaN " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "floor_df = floor.get_floor(collections)\n", "floor_df.tail()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.9" } }, "nbformat": 4, "nbformat_minor": 5 }